#version 450 compatibility





#define BlockNum 16

layout(local_size_x = DEF_LocalSize, local_size_y = DEF_LocalSize, local_size_z = 1) in;

layout( binding = 0, rgba8ui) uniform uimage2D Pix;

layout( binding = 1 ) uniform Buf_LoalParameter0 {
    ivec4   m_Box;
    uint    m_FillType;            //填充纹理类型
    uint    m_OverlayMode;         //叠加模式
    float   m_TexScale;            //纹理缩放
};


void main(){
    ivec2 coord = ivec2(gl_WorkGroupID.x, gl_WorkGroupID.y);
    
    int x = int(float(coord.x)/m_TexScale);
    coord.x += coord.y;
    if(coord.x >= gl_NumWorkGroups.x) {
        coord.x = int(abs(coord.x - gl_NumWorkGroups.x));
    }

    uvec4 color = imageLoad(Pix, coord);
    float c = float(color.r)*0.3 + float(color.g)*0.59 + float(color.b)*0.11;
    

    if( (x&1) == 0){
        c *= 0.3;
    } else {
        c *= 0.7;
    }
    color.x = uint(c);
    color.y = uint(c);
    color.z = uint(c);
    imageStore(Pix, coord, color);
    
}


//棋盘格纹理生成
void f_tex_Checkerboard(){

}



